package com.example.smartall.utils;

import android.content.Context;
import android.graphics.Rect;
import android.view.View;

import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.RecyclerView;

/**
 * @author abbas
 * @brief 这个类没必要，可以直接new类复写即可
 * @date 2022-01-27
 */
public class RecycleDecoration extends RecyclerView.ItemDecoration {
    /**
     * Creates a divider {@link RecyclerView.ItemDecoration} that can be used with a
     * {@link LinearLayoutManager}.
     *
     * @param context     Current context, it will be used to access resources.
     * @param orientation Divider orientation. Should be {@link #HORIZONTAL} or {@link #VERTICAL}.
     */

    private int topSpace;
    private int leftSpace;
    private int rightSpace;
    private int bottomSpace;

    public RecycleDecoration(int topSpace, int leftSpace, int rightSpace, int bottomSpace) {
        this.topSpace = topSpace;
        this.leftSpace = leftSpace;
        this.rightSpace = rightSpace;
        this.bottomSpace = bottomSpace;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        outRect.top = topSpace;
        outRect.bottom = bottomSpace;
        outRect.left = leftSpace;
        outRect.right = rightSpace;
    }
}

